package c

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type UserRouter struct{}

func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup) {
	userRouter := Router.Group("user")
	userRouterWithAuth := Router.Group("user").Use(middleware.JWTAuth())
	{
		userRouter.POST("register", userApi.Register) // 用户注册
		userRouter.POST("login", userApi.Login)       // 用户登录
	}
	{
		userRouterWithAuth.GET("getUserInfo", userApi.GetUserInfo)         // 获取个人信息
		userRouterWithAuth.PUT("setSelfInfo", userApi.SetSelfInfo)         // 设置用户信息
		userRouterWithAuth.POST("changePassword", userApi.ChangePassword)  // 修改密码
		userRouterWithAuth.POST("follow", userApi.FollowUser)              // 关注/取关用户
		userRouterWithAuth.GET("getUserInfoById", userApi.GetUserInfoById) // 获取他人用户信息，根据ID获取用户信息（包含关注状态）
	}
}
